package com.pattern.objectcreator.simplefactory;

/**
 * @author yangguanzan
 * @date 3/15/22
 * @description
 */
public class SimpleFactory {

    private SimpleFactory(){
        //nothing
    }


    public static SimpleOperation createOperation(SimpleOperationEnum value) {
        //创建加法算法类
        if(SimpleOperationEnum.PLUS.equals(value)){
            return new PlusOPeration();
        }
        //创建减法算法类
        if(SimpleOperationEnum.MINUS.equals(value)){
            return new MinusOPeration();
        }
        //创建乘法算法类
        if(SimpleOperationEnum.MULTIPLY.equals(value)){
            return new MultiplyOPeration();
        }
        //创建除法算法类
        if(SimpleOperationEnum.DIVIDE.equals(value)){
            return new DivideOPeration();
        }
        return null;
    }
}
